package site.xuxingcan.contactchange;

import android.content.Context;
import android.content.SharedPreferences;

public class SharedPreferenceUtil {
    private static volatile SharedPreferenceUtil instance = null;

    public static SharedPreferenceUtil getInstance(Context mContext) {
        if (instance == null) {
            synchronized (SharedPreferenceUtil.class) {
                if (instance == null) {
                    instance = new SharedPreferenceUtil(mContext);
                }
            }
        }
        return instance;
    }

    private SharedPreferences mSharedPreferences;

    private SharedPreferenceUtil(Context mContext) {
        mSharedPreferences = mContext.getSharedPreferences("default", Context.MODE_PRIVATE);
    }

    public void setIsOk(boolean s) {
        mSharedPreferences.edit().putBoolean("is", s).apply();
    }

    public boolean getIsOk() {
        return mSharedPreferences.getBoolean("is", false);
    }

    public String getPath() {
        return mSharedPreferences.getString("path", null);
    }

    public void setPath(String path) {
        mSharedPreferences.edit().putString("path", path).apply();
    }
}
